#include <iostream>
#include <string>
#include <fstream>
#include "conio.h"
using namespace std;

void main () 
{
	int a;
	char movie[20];
	cout << "\t\t======== welcome to our store ========\n" << endl;
	cout << " to insert new movies press 1 then enter \n to see what in store press 2 then enter \n to search for a movie press 3 then enter ";
	cin >> a ;
	if(a==1)
	{
		cout << "please enter the name of the new movie\n";
		getchar();
		gets (movie);
	ofstream myfile;
	myfile.open ("movies data base.txt",ios::app);
    myfile << movie <<endl;
    myfile.close();
	}
	else if (a==2)
	{
		string line;
		ifstream myfile;
		myfile.open ("movies data base.txt");
		while ( getline (myfile,line) )
		{
			cout << line << endl;
		}
		 myfile.close();
	}
	else if (a==3)
	{
		int k=0;
		string line;
		string wanted;
		cout << "enter the title of the movie you want to search for" << endl;
		getchar();
		getline(cin, wanted);
		ifstream myfile;
		myfile.open ("movies data base.txt");
		while ( getline (myfile,line) )
		{
			if (line == wanted)
			{
				cout << "the movie is available in store" <<endl;
				k=1;
				break;
			}
		}
		 myfile.close();
		 if(k==0)
		 {
			 cout <<"not available";
		 }
	}
	else 
	{ cout << "wrong chocie" ;}
  
  getche();
}